home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1998 #4
/
Amiga Plus CD - 1998 - No. 4.iso
/
pd
/
grafik
/
metaview
/
arexx-examples
/
pagestream_import.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-10-08
|
2KB
|
122 lines
/* Graphik Import in PageStream3 mittels MetaView */
call open("STDERR","ram:tracePSG","W")
trace r
METAVIEW = 'MetaView:MetaView' /* Please complete the path */
OPTIONS RESULTS
SIGNAL ON FAILURE
SIGNAL ON SYNTAX
/*
** Looking for our start process
*/
PGSPORT = ADDRESS()
if (LEFT(PGSPORT, 10) ~= "PAGESTREAM") then do /* not started from DrawStudio */
say "Please start me from PageStream!"
EXIT
end
/*
** Create a new Metaview process:
** first look for the allready running processes
** then the new Port will be the next one
*/
do NUMBER = 0 to 20
if (SHOW(PORTS,"METAVIEW." || NUMBER) = 0) then
leave
end
/*
** Searching for MetaView: 1. our path above,
** 2. path in env:MetaView.path
** or 3. you must have a assign "MetaView:"
*/
if (EXISTS(METAVIEW)=0) then do
if OPEN("MVVAR","env:MetaView.path","Read") then do
METAVIEW = READLN("MVVAR")
end
if (EXISTS(METAVIEW)=0) then do
METAVIEW = "MetaView:MetaView"
end
end
/*
** Enable warnings for WaitForPort
*/
OPTIONS FAILAT 5
ADDRESS COMMAND
"run " || METAVIEW || " NODISPLAY"
MVPORT = "METAVIEW." || NUMBER
"WaitForPort " || MVPORT
/*
** Ignore the other errors
*/
OPTIONS FAILAT 21
defilename = getclip(metafilename)
depathname = getclip(metapathname)
ADDRESS PAGESTREAM
if defilename = "" then GETFILE TITLE "Select drawing" LOAD POSBUTTON Load NEGBUTTON Cancel
else GETFILE TITLE "Select drawing" LOAD PATH depathname FILE defilename POSBUTTON Load NEGBUTTON Cancel
if rc=10 then EXIT
filename = result
call setclip(metafilename, getname(filename))
call setclip(metapathname, getpath(filename))
/*
** Do all needed things with MetaView (LOAD,SAVE,QUIT...)
*/
ADDRESS VALUE MVPORT
LOAD '"'filename'"'
SAVE "t:test.dr2d" AS DR2D
QUIT
/*
** Import the temporary file in application
*/
ADDRESS 'PAGESTREAM'
'PLACEGRAPHIC FILE t:test.dr2d FILTER IFFDR2D STATUS'
EXIT
FAILURE:
ADDRESS COMMAND
REQUESTCHOICE "Error" """Can't find" METAVIEW "!""" "OK"
EXIT
SYNTAX:
say "Error on line" SIGL ":" ERRORTEXT(RC) "!"
EXIT
getpath:
parse arg allname
pos1 = lastpos("/",allname)
if pos1 = 0 then pos1 = lastpos(":",allname)
filepath = left(allname,pos1)
return filepath
getname:
parse arg allname
pos1 = lastpos("/",allname)
if pos1 = 0 then pos1 = lastpos(":",allname)
justname = substr(allname,pos1+1)
return justname